/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package entities;

import java.io.IOException;
import java.io.Reader;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

/**
 *
 * @author michael
 */
public class MyBatisUtil {
    
    private static SqlSessionFactory factory;

 private MyBatisUtil() {
 }
 
 public static SqlSessionFactory getSqlSessionFactory() 
 {
     Reader reader = null;
  try {
   reader = Resources.getResourceAsReader("myBatis/myBatis.xml");
   

  } catch (IOException e) {
   throw new RuntimeException(e.getMessage());
  }
  factory = new SqlSessionFactoryBuilder().build(reader);
//  factory.getConfiguration().addMapper(MembersMapper.class);
     
  return factory;
 }
    
}
